package com.smart.cloud.gateway.fliter;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;

import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;


public class IPKeyResolver implements KeyResolver {
    @Override
    public Mono<String> resolve(ServerWebExchange exchange) {
//        RequestPath path = exchange.getRequest().getPath();
        return Mono.just(exchange.getRequest().getRemoteAddress().getAddress().getHostAddress());
    }
}
